
<?
	 layout("/inc/win_layout.html",{title:sysTitle}){
    ?>

	<div class="page-content">
		<table class="table table-hover table-striped table-bordered table-advanced tablesorter mbn">
			<thead>
				<tr>
					<th ><input type="checkbox" class="checkall" name="onecheckall" /></th>
					<th >序号</th>
					<th >中文名称</th>
					<th >英文名称</th>
					<th >字典项值</th>
				</tr>
			</thead>
			<tbody id="findUser">
			</tbody>
		</table>
		<div id="dataNull" class="panel-body" style="height: 90px; line-height: 50px;" align="center"></div>
		<div id="page2" style="text-align: center; margin-top: 20px;"></div>
	</div>
	<!--END CONTENT-->


<?} ?>
<script type="text/javascript">
	function getQueryString(name) { 
		var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i"); 
		var r = window.location.search.substr(1).match(reg); 
		if (r != null) return unescape(r[2]); return null; 
	} 
	var winName=getQueryString("winName");
	var curr;
	$(function() {
		demo();
	});
	function demo(curr) {
		$.ajax({
			type : "post",
			url : "showKnowledgeClassesButton.do",
			data : {
				"page" : curr || 1,
				"dictItemEn" : "web_list_buttons",
			},
			dataType : "json",
			traditional : true,
			success : function(res) {
				//alert(JSON.stringify(res));
				//此处仅仅是为了演示变化的内容
				var str = "";
				$("#findUser").html("");
				if(res[0].count > 0){
					$("#dataNull").html("");
				}else{
					$("#dataNull").html("<span class='subtitle' style='font-size: 15px;'>数据为空!</span>");
				}
				for ( var i = 0; i < res[0].data.length; i++) {
					str += "<tr><td><input name='checkall' type='checkbox' value='"+res[0].data[i].value+"' data-nameZh = '"+res[0].data[i].nameZh+"' /></td><td>"
							+ (i + 1)
							+ "</td><td>"
							+ res[0].data[i].nameZh
							+ "</td><td>"
							+ res[0].data[i].nameEn
							+ "</td><td>"
							+ res[0].data[i].value
							+ "</td></tr>";
				}
				$("#findUser").append(str);

				laypage({
					cont : document.getElementById('page2'), //容器。值支持id名、原生dom对象，jquery对象,
					pages : res[0].page, //总页数
					skip : true, //是否开启跳页
					skin : 'molv', //加载内置皮肤，也可以直接赋值16进制颜色值，如:#c00
					curr: curr || 1,
					last: res[0].page,
					groups : 6,//连续显示分页数
					jump : function(obj, first) { //触发分页后的回调
						if (!first) { //点击跳页触发函数自身，并传递当前页：obj.curr
							demo(obj.curr);
			                 curr=obj.curr;
						}
					}
				});
			},
			error : function(data) {
				alert("请求失败");
			}
		});
	};
	var index = parent.layer.getFrameIndex(window.name);
	function  save(){
		var value='';
		var nameZh='';
		$("input[name='checkall']:checked").each(function(){
			value += $(this).val()+";";
			nameZh += $(this).attr("data-nameZh")+";";
		});
		if(value != '' && value != null){
			window.parent.window[winName].$("#webListButtonsName").val(nameZh);
		    window.parent.window[winName].$("#webListButtons").val(value.substring(0, value.length-1));
		}
	    parent.layer.close(index);
	    
     }
</script>